package com.threeti.mecool.core.infrastructure.persistence.plan;

import com.threeti.mecool.core.domain.model.plan.pojo.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TaskRepository extends JpaRepository<Task, Long> {
    Task findByDataTypeId(Long dataTypeId);

    @Query("select t from Task t, TaskActionDataType d where t.dataTypeId=d.id and (t.removed is null or t.removed = 0) order by t.actionId, d.name, nvl(t.updatedAt, to_date('2000-1-1', 'yyyy-MM-dd')) desc")
    List<Task> findAllActive();
}
